
package com.cosc645.ecash;

import java.math.BigInteger;
import java.security.interfaces.RSAPublicKey;

public class Bob {

    public MoneyOrder getBankSignedMoneyOrder() {
        return bankSignedMoneyOrder;
    }

    public void setBankSignedMoneyOrder(MoneyOrder signed) {
        bankSignedMoneyOrder = signed;
    }

    BigInteger r;
    private MoneyOrder bankSignedMoneyOrder;

    public BigInteger verifyBankSignature(RSAPublicKey publicKey, BigInteger unblindedT) {
        BigInteger e = publicKey.getPublicExponent();
        BigInteger n = publicKey.getModulus();
        
        BigInteger originalM = unblindedT.modPow(publicKey.getPublicExponent(), publicKey.getModulus());
        System.out.println("OriginalM decrypted by Bob using bank's public key: "+ originalM);
        
        return originalM;
        
    }

    public void setR(BigInteger r){
        this.r = r;
    }

    public BigInteger getR(){
        return r;
    }



    public boolean verifyR(BigInteger aliceR){
        if(r == aliceR)
            return true;
        else
            return false;
    }
}
